<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>PowerVR SDK</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<table width="100%">
  <tr>
    <td width="33%">
      <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
    </td>
    <td width="33%">
      <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
    </td>
    <td width="34%">
      <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
    </td>
  </tr>
</table>
<hr>
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>ambientdiffuse.h</h1><a href="ambientdiffuse_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/******************************************************************************</span>
00002 <span class="comment"></span>
00003 <span class="comment"> @File         ambientdiffuse.h</span>
00004 <span class="comment"></span>
00005 <span class="comment"> @Title        </span>
00006 <span class="comment"></span>
00007 <span class="comment"> @Version      </span>
00008 <span class="comment"></span>
00009 <span class="comment"> @Copyright    Copyright (C)  Imagination Technologies Limited.</span>
00010 <span class="comment"></span>
00011 <span class="comment"> @Platform     ANSI compatible</span>
00012 <span class="comment"></span>
00013 <span class="comment"> @Description  A default PFX to be used with the PVREngine when no other PFX is</span>
00014 <span class="comment">               specified.</span>
00015 <span class="comment"></span>
00016 <span class="comment">******************************************************************************/</span>
00017 
00018 <span class="preprocessor">#ifndef _AMBIENT_DIFFUSE_H_</span>
00019 <span class="preprocessor"></span><span class="preprocessor">#define _AMBIENT_DIFFUSE_H_</span>
00020 <span class="preprocessor"></span>
00021 <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="ambientdiffuse_8h.html#a0">ambdiffpointshader</a>[] =
00022 <span class="stringliteral">"[HEADER]\n"</span>
00023 <span class="stringliteral">"   VERSION     01.00.00.00\n"</span>
00024 <span class="stringliteral">"   DESCRIPTION Texturing with a single diffuse point light\n"</span>
<a name="l00025"></a><a class="code" href="ambientdiffuse_8h.html#a0">00025</a> <span class="stringliteral">"   COPYRIGHT   Img Tec\n"</span>
00026 <span class="stringliteral">"[/HEADER]\n"</span>
00027 
00028 <span class="stringliteral">"[TEXTURES]\n"</span>
00029 <span class="stringliteral">"   FILE basemap        Flat.pvr    LINEAR-LINEAR-LINEAR\n"</span>
00030 <span class="stringliteral">"[/TEXTURES]\n"</span>
00031 
00032 <span class="stringliteral">"[EFFECT]\n"</span>
00033 <span class="stringliteral">"   NAME    BasicDiffuse\n"</span>
00034 
00035     <span class="comment">// GLOBALS UNIFORMS</span>
00036 <span class="stringliteral">"   UNIFORM myViewIT        WORLDIT\n"</span>
00037 <span class="stringliteral">"   UNIFORM myMVPMatrix     WORLDVIEWPROJECTION\n"</span>
00038 <span class="stringliteral">"   UNIFORM myLightDirection    LIGHTPOSWORLD\n"</span>
00039 <span class="stringliteral">"   UNIFORM mAmbient        MATERIALCOLORAMBIENT\n"</span>
00040 <span class="stringliteral">"   UNIFORM mDiffuse        MATERIALCOLORDIFFUSE\n"</span>
00041 <span class="stringliteral">"   UNIFORM basemap         TEXTURE0\n"</span>
00042 <span class="stringliteral">"   UNIFORM fOpacity        MATERIALOPACITY\n"</span>
00043 
00044     <span class="comment">// ATTRIBUTES</span>
00045 <span class="stringliteral">"   ATTRIBUTE   myVertex    POSITION\n"</span>
00046 <span class="stringliteral">"   ATTRIBUTE   myNormal    NORMAL\n"</span>
00047 <span class="stringliteral">"   ATTRIBUTE   myUV        UV\n"</span>
00048 
00049 <span class="stringliteral">"   VERTEXSHADER MyVertexShader\n"</span>
00050 <span class="stringliteral">"   FRAGMENTSHADER MyFragmentShader\n"</span>
00051 <span class="stringliteral">"   TEXTURE 0 basemap\n"</span>
00052 
00053 <span class="stringliteral">"[/EFFECT]\n"</span>
00054 
00055 <span class="stringliteral">"[VERTEXSHADER]\n"</span>
00056 <span class="stringliteral">"   NAME        MyVertexShader\n"</span>
00057 
00058     <span class="comment">// LOAD GLSL AS CODE</span>
00059 <span class="stringliteral">"   [GLSL_CODE]\n"</span>
00060 <span class="stringliteral">"   attribute highp vec3    myVertex;\n"</span>
00061 <span class="stringliteral">"   attribute mediump vec3  myNormal;\n"</span>
00062 <span class="stringliteral">"   attribute mediump vec2  myUV;\n"</span>
00063 
00064 <span class="stringliteral">"   uniform highp mat4  myMVPMatrix;\n"</span>
00065 <span class="stringliteral">"   uniform mediump mat3    myViewIT;\n"</span>
00066 <span class="stringliteral">"   uniform mediump vec3    myLightDirection;\n"</span>
00067 <span class="stringliteral">"   uniform lowp    vec3    mAmbient;\n"</span>
00068 <span class="stringliteral">"   uniform lowp    vec3    mDiffuse;\n"</span>
00069 
00070 <span class="stringliteral">"   varying mediump vec3    Normal;\n"</span>
00071 <span class="stringliteral">"   varying mediump vec2    texCoordinate;\n"</span>
00072 <span class="stringliteral">"   varying mediump vec3    DiffuseIntensity;\n"</span>
00073 
00074 
00075 <span class="stringliteral">"       void main(void)\n"</span>
00076 <span class="stringliteral">"       {\n"</span>
00077 <span class="stringliteral">"           gl_Position = myMVPMatrix * vec4(myVertex,1.0);\n"</span>
00078 <span class="stringliteral">"           Normal = normalize(myViewIT * myNormal);\n"</span>
00079 <span class="stringliteral">"           lowp float litFactor = dot(Normal, normalize(myLightDirection-myVertex));\n"</span>
00080 <span class="stringliteral">"           DiffuseIntensity = vec3(litFactor*mDiffuse)+mAmbient;\n"</span>
00081 <span class="stringliteral">"           texCoordinate = myUV.st;\n"</span>
00082 <span class="stringliteral">"       }\n"</span>
00083 <span class="stringliteral">"   [/GLSL_CODE]\n"</span>
00084 <span class="stringliteral">"[/VERTEXSHADER]\n"</span>
00085 
00086 <span class="stringliteral">"[FRAGMENTSHADER]\n"</span>
00087 <span class="stringliteral">"   NAME        MyFragmentShader\n"</span>
00088 
00089     <span class="comment">// LOAD GLSL AS CODE</span>
00090 <span class="stringliteral">"   [GLSL_CODE]\n"</span>
00091 <span class="stringliteral">"       uniform sampler2D       basemap;\n"</span>
00092 <span class="stringliteral">"       uniform lowp    float   fOpacity;\n"</span>
00093 <span class="stringliteral">"       varying mediump vec3    DiffuseIntensity;\n"</span>
00094 <span class="stringliteral">"       varying mediump vec2    texCoordinate;\n"</span>
00095 
00096 <span class="stringliteral">"       void main (void)\n"</span>
00097 <span class="stringliteral">"       {\n"</span>
00098 <span class="stringliteral">"           gl_FragColor =   texture2D(basemap, texCoordinate) * vec4(DiffuseIntensity,fOpacity);\n"</span>
00099 <span class="stringliteral">"       }\n"</span>
00100 <span class="stringliteral">"   [/GLSL_CODE]\n"</span>
00101 <span class="stringliteral">"[/FRAGMENTSHADER]\n"</span>;
00102 
00103 <span class="preprocessor">#endif  // _AMBIENT_DIFFUSE_H_</span>
00104 <span class="preprocessor"></span>
</pre></div><br>
<br>
<P align=left><FONT size=2><STRONG><A 
   href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> � 
   1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
<hr>
<address style="align: left;"><small><FONT color=f0f>
Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
</body>
</html>
